<?php
require_once("config.php");
$fileHash=$_GET["fileid"];
if (file_exists($upload_dir . $fileHash)) {
    $fileName = file_get_contents($upload_dir . $fileHash . ".name");
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=' . $fileName);
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($upload_dir . $fileHash));
    ob_clean();
    flush();
    readfile($upload_dir . $fileHash);
} else {
echo "File not found. Perhaps it was uploaded more than 30 days ago? Uploaded files are automatically deleted after 30 days.";
}
?>